/*
 * The MIT License
 *
 * Copyright 2015 chronosinfo.com.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 * Autor John Vanderson M Lima
 */

package com.chronos.pafecf.entidades;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author usuario
 */
@Entity
@Table(name = "CLIENTE", catalog = "", schema = "")
@NamedQueries({
    @NamedQuery(name = "Cliente.findAll", query = "SELECT c FROM Cliente c")})
public class Cliente implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID", nullable = false)
    private Integer id;
    @Column(name = "NOME", length = 150)
    private String nome;
    @Column(name = "FANTASIA", length = 150)
    private String fantasia;
    @Column(name = "EMAIL", length = 250)
    private String email;
    @Column(name = "CPF_CNPJ", length = 14)
    private String cpfCnpj;
    @Column(name = "RG", length = 20)
    private String rg;
    @Column(name = "ORGAO_RG", length = 20)
    private String orgaoRg;
    @Column(name = "DATA_EMISSAO_RG")
    @Temporal(TemporalType.DATE)
    private Date dataEmissaoRg;
    @Column(name = "SEXO")
    private Character sexo;
    @Column(name = "INSCRICAO_ESTADUAL", length = 30)
    private String inscricaoEstadual;
    @Column(name = "INSCRICAO_MUNICIPAL", length = 30)
    private String inscricaoMunicipal;
    @Column(name = "TIPO_PESSOA")
    private Character tipoPessoa;
    @Column(name = "DATA_CADASTRO")
    @Temporal(TemporalType.DATE)
    private Date dataCadastro;
    @Column(name = "LOGRADOURO", length = 250)
    private String logradouro;
    @Column(name = "NUMERO", length = 6)
    private String numero;
    @Column(name = "COMPLEMENTO", length = 50)
    private String complemento;
    @Column(name = "CEP", length = 8)
    private String cep;
    @Column(name = "BAIRRO", length = 100)
    private String bairro;
    @Column(name = "CIDADE", length = 100)
    private String cidade;
    @Column(name = "UF", length = 2)
    private String uf;
    @Column(name = "FONE1", length = 10)
    private String fone1;
    @Column(name = "FONE2", length = 10)
    private String fone2;
    @Column(name = "CELULAR", length = 10)
    private String celular;
    @Column(name = "CONTATO", length = 50)
    private String contato;
    @Column(name = "CODIGO_IBGE_CIDADE")
    private Integer codigoIbgeCidade;
    @Column(name = "CODIGO_IBGE_UF")
    private Integer codigoIbgeUf;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idCliente")
    private List<EcfChequeCliente> ecfChequeClienteList;
    @OneToMany(mappedBy = "idCliente")
    private List<EcfVendaCabecalho> ecfVendaCabecalhoList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idCliente")
    private List<NotaFiscalCabecalho> notaFiscalCabecalhoList;
    @JoinColumn(name = "ID_SITUACAO_CLIENTE", referencedColumnName = "ID", nullable = false)
    @ManyToOne(optional = false)
    private SituacaoCliente idSituacaoCliente;

    public Cliente() {
    }

    public Cliente(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getFantasia() {
        return fantasia;
    }

    public void setFantasia(String fantasia) {
        this.fantasia = fantasia;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getCpfCnpj() {
        return cpfCnpj;
    }

    public void setCpfCnpj(String cpfCnpj) {
        this.cpfCnpj = cpfCnpj;
    }

    public String getRg() {
        return rg;
    }

    public void setRg(String rg) {
        this.rg = rg;
    }

    public String getOrgaoRg() {
        return orgaoRg;
    }

    public void setOrgaoRg(String orgaoRg) {
        this.orgaoRg = orgaoRg;
    }

    public Date getDataEmissaoRg() {
        return dataEmissaoRg;
    }

    public void setDataEmissaoRg(Date dataEmissaoRg) {
        this.dataEmissaoRg = dataEmissaoRg;
    }

    public Character getSexo() {
        return sexo;
    }

    public void setSexo(Character sexo) {
        this.sexo = sexo;
    }

    public String getInscricaoEstadual() {
        return inscricaoEstadual;
    }

    public void setInscricaoEstadual(String inscricaoEstadual) {
        this.inscricaoEstadual = inscricaoEstadual;
    }

    public String getInscricaoMunicipal() {
        return inscricaoMunicipal;
    }

    public void setInscricaoMunicipal(String inscricaoMunicipal) {
        this.inscricaoMunicipal = inscricaoMunicipal;
    }

    public Character getTipoPessoa() {
        return tipoPessoa;
    }

    public void setTipoPessoa(Character tipoPessoa) {
        this.tipoPessoa = tipoPessoa;
    }

    public Date getDataCadastro() {
        return dataCadastro;
    }

    public void setDataCadastro(Date dataCadastro) {
        this.dataCadastro = dataCadastro;
    }

    public String getLogradouro() {
        return logradouro;
    }

    public void setLogradouro(String logradouro) {
        this.logradouro = logradouro;
    }

    public String getNumero() {
        return numero;
    }

    public void setNumero(String numero) {
        this.numero = numero;
    }

    public String getComplemento() {
        return complemento;
    }

    public void setComplemento(String complemento) {
        this.complemento = complemento;
    }

    public String getCep() {
        return cep;
    }

    public void setCep(String cep) {
        this.cep = cep;
    }

    public String getBairro() {
        return bairro;
    }

    public void setBairro(String bairro) {
        this.bairro = bairro;
    }

    public String getCidade() {
        return cidade;
    }

    public void setCidade(String cidade) {
        this.cidade = cidade;
    }

    public String getUf() {
        return uf;
    }

    public void setUf(String uf) {
        this.uf = uf;
    }

    public String getFone1() {
        return fone1;
    }

    public void setFone1(String fone1) {
        this.fone1 = fone1;
    }

    public String getFone2() {
        return fone2;
    }

    public void setFone2(String fone2) {
        this.fone2 = fone2;
    }

    public String getCelular() {
        return celular;
    }

    public void setCelular(String celular) {
        this.celular = celular;
    }

    public String getContato() {
        return contato;
    }

    public void setContato(String contato) {
        this.contato = contato;
    }

    public Integer getCodigoIbgeCidade() {
        return codigoIbgeCidade;
    }

    public void setCodigoIbgeCidade(Integer codigoIbgeCidade) {
        this.codigoIbgeCidade = codigoIbgeCidade;
    }

    public Integer getCodigoIbgeUf() {
        return codigoIbgeUf;
    }

    public void setCodigoIbgeUf(Integer codigoIbgeUf) {
        this.codigoIbgeUf = codigoIbgeUf;
    }

    public List<EcfChequeCliente> getEcfChequeClienteList() {
        return ecfChequeClienteList;
    }

    public void setEcfChequeClienteList(List<EcfChequeCliente> ecfChequeClienteList) {
        this.ecfChequeClienteList = ecfChequeClienteList;
    }

    public List<EcfVendaCabecalho> getEcfVendaCabecalhoList() {
        return ecfVendaCabecalhoList;
    }

    public void setEcfVendaCabecalhoList(List<EcfVendaCabecalho> ecfVendaCabecalhoList) {
        this.ecfVendaCabecalhoList = ecfVendaCabecalhoList;
    }

    public List<NotaFiscalCabecalho> getNotaFiscalCabecalhoList() {
        return notaFiscalCabecalhoList;
    }

    public void setNotaFiscalCabecalhoList(List<NotaFiscalCabecalho> notaFiscalCabecalhoList) {
        this.notaFiscalCabecalhoList = notaFiscalCabecalhoList;
    }

    public SituacaoCliente getIdSituacaoCliente() {
        return idSituacaoCliente;
    }

    public void setIdSituacaoCliente(SituacaoCliente idSituacaoCliente) {
        this.idSituacaoCliente = idSituacaoCliente;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cliente)) {
            return false;
        }
        Cliente other = (Cliente) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.chronos.pafecf.entidades.Cliente[ id=" + id + " ]";
    }
    
}
